USE [WarehouseManagement]
GO
/****** Object:  StoredProcedure [dbo].[ChangePassword]    Script Date: 04/09/2011 00:46:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		AnhDQ
-- Create date: 3/22/2011
-- Description:	This stored procedure use to delete an Employee record
-- =============================================
CREATE PROCEDURE [dbo].[ChangePassword]
(
	@EmployeeID Int = 0
	, @Username nvarchar(MAX) = ''
	, @Password nvarchar(MAX) = ''
	, @NewPassword nvarchar(MAX) = '' 
)
AS
BEGIN
	
	IF (EXISTS (
				SELECT 1 FROM [Employee] 
				WHERE	
						[EmployeeID] = @EmployeeID AND 
						[Username] = @Username AND 
						[Password] = @Password AND [IsDelete]  = 0
				)
		)
	BEGIN
		UPDATE 
				Employee 
		SET 
				[Password] = @NewPassword
		WHERE 
				EmployeeID = @EmployeeID
	END
END

/*
USE WarehouseManagement
GO

EXEC [ChangePassword] 4
*/